<template>
	<view class="wrap">
		<view v-if="showList.length">
			<view class="orderWrap" v-for="item in showList" :key="item.orderNo">
				<view class="orderTitle">
					<view class="orderNo">订单号：{{item.orderNo}}</view>
					<view class="ordertime">下单时间：{{item.orderTime}}</view>
				</view>
				<view class="orderInfo">
					<view class="orderItem" v-for="(item1,index) in item.orderInfo" :key="index">
						<view class="pic">
							<image :src="item1.goods_pic[0].pics_url" mode="widthFix"></image>
						</view>
						<view class="orderIntru">
							<view class="goodsName">{{item1.goods_name}}</view>
							<view class="goodsNum">数量：X{{item1.goods_num}}</view>
							<view class="goodsPrice">单价:￥{{item1.goods_price}}</view>
						</view>
					</view>
				</view>
				<view class="total">实付款:<text>￥{{item.total}}</text>元</view>
			</view>
		</view>

		<view class="oderNull" v-else>暂无订单</view>


	</view>
</template>

<script>
	export default {
		data() {
			return {
				orderList: [],
				showList: []
			}
		},
		onShow() {
			if (uni.getStorageSync("orderList")) {
				this.orderList = uni.getStorageSync("orderList")
			} else {
				this.orderList = []
			}
			this.showList = this.orderList.filter(v => v.loginInfo == uni.getStorageSync("loginInfo"))
		},
		methods: {

		}
	}
</script>

<style lang="less">
	.wrap {
		padding: 30rpx;

		.orderWrap {
			border-bottom: 16rpx solid #efefef;

			.orderTitle {
				display: flex;
				height: 80rpx;
				justify-content: space-between;
				align-items: center;
				border-bottom: 1rpx solid #efefef;

				.orderNo,
				.ordertime {
					flex: 1;
					font-size: 28rpx;
				}
			}

			.orderInfo {
				.orderItem {
					display: flex;
					border-bottom: 1rpx solid #efefef;

					.pic {
						flex: 3;

						image {
							width: 100%;
						}
					}

					.orderIntru {
						flex: 5;
						display: flex;
						flex-direction: column;
						justify-content: center;
						line-height: 80rpx;
						padding-left: 20rpx;
					}
				}
			}
		}

		.total {
			display: flex;
			justify-content: flex-end;
			padding: 30rpx;
			font-size: 32rpx;
			font-weight: bold;

			text {
				color: skyblue;
			}
		}
	}
	.oderNull{
		text-align: center;
		color: orangered;
		font-weight: bold;
		font-size: 20px;
	}
</style>
